package chapter1.classTest.task;

import java.io.*;


/*
1：从1开始，写入100个质数到文件中，用空格隔开，10个一行。
 */
public class Task1 {
    public static void main(String[] args) throws Exception {
        Writer out = new FileWriter("F:\\123\\1.txt");

        int count = 0;
        int i, j;
        for (i = 2; count < 100; i++) {
            for (j = 2; j * j <= i && i % j != 0; j++) ;
            if (j * j > i) {
                count++;
                if (count % 10 == 0)
                    out.write(i + "\n");
                else
                    out.write(i + " ");
            }
        }

        out.close();
    }
}
